package org.coderjonny.controller;

import org.coderjonny.bean.User;
import org.coderjonny.dto.Request;
import org.coderjonny.dto.Result;
import org.coderjonny.dto.user.UserId;
import org.coderjonny.service.UserService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class UserController {

    @Resource
    private UserService userService;
    @PostMapping("/getByUserId")
    public Result<User> selectUserById(@Validated @RequestBody Request<UserId> request){
        User user = userService.getUserById(request.getData());
        return Result.ok(user);
    }
}

